package com.warren.blog.test;

import java.io.FileInputStream;
import java.io.IOException;

/**
 * @author warren
 */
public class FileCharStream {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("/Users/WWei15/Documents/hello-springboot/oss1.txt");
        byte[] by = new byte[5];
        int len = fis.read(by);
        System.out.println(len);
        System.out.println(new String(by));

        //循环
        while (len != -1) {
            len = fis.read(by);
//            System.out.println(len);
            System.out.print(new String(by, 0, len));
        }
    }
}
